Support Empty Array in Constructor Arguments#69
Merged
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR adds support for empty array constructor arguments by preserving ABI type information and improves error reporting when build-info files are missing.
- Include the contract name in the “no build-info” error message
- Populate a backup
type_stringfor constructor args from the ABI - Handle empty arrays by retaining the ABI type and setting the value to
0x
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| lib/bytecode_verification/parse_json.rs | Enhanced error message; initialized type_string from ABI selector |
| lib/bytecode_verification/compare_bytecodes.rs | Switched println to debug log; added handling for empty-array values |
Comments suppressed due to low confidence (2)
lib/bytecode_verification/parse_json.rs:1446
- The format! call uses a named placeholder
{contract_name}without providing a named argument. Change this to use a positional placeholder, e.g.,format!("No build-info files for {} could be found.", contract_name).
format!("No build-info files for {contract_name} could be found.")
lib/bytecode_verification/compare_bytecodes.rs:300
- No tests cover the empty-array constructor argument path. Add unit tests to verify that empty arrays are handled correctly and that
arg.valueandarg.type_stringare set as expected.
if encoded_value.len() == 0 {
906c213 to
a50a813
Compare
a50a813 to
661d944
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Currently the code fails when there is an empty array passed as a constructor argument because it cannot figure out the type during the decoding.
Now we remember the type given by the ABI.
Long-term we should probably generally check that ABI types and decoded types match.